package chixing.day18.thread;

public class NumberThread implements Runnable{
    private CharThread charThread;
    public NumberThread(){}
    public NumberThread (CharThread charThread){
        this.charThread = charThread;
    }
    @Override
    public void run() {
        for (int i = 1; i < 20;i++){
            System.out.println("数字是---------------------" + i);
            try {
                Thread.sleep(300);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            if (i==10){
                try {
                    charThread.join();//加入其他线程
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        }
    }
}
